home *** CD-ROM | disk | FTP | other *** search
/ EnigmA Amiga Run 1995 October / EnigmA AMIGA RUN 01 (1995)(G.R. Edizioni)(IT)[!][issue 1995-10][Aminet 7].iso / Aminet / comm / cnet / pgntitledit11.lha / PGNTitleEdit next >
Text File  |  1995-06-13  |  7KB  |  94 lines

  1. /**************************************************************************\
  2.            $VER: PGN Title Edit, v1.1 (13-Jun-95) by Dotoran!
  3. \**************************************************************************/
  4. options results;signal on SYNTAX;signal on ERROR;signal on IOERR
  5. tr=transmit;se=sendstring;gc=getchar;gu=getuser;gs=getscratch
  6. a='rexxsupport.library';if ~show('l',a) then if ~addlib(a,0,-30) then exit
  7.  
  8. gu 1409358;gu 1308046+substr('9012345678',result+1,1)*80
  9. lc=index("PGN",left(upper(result),1));zz=word("pfiles: gfiles: news:",lc)
  10. df=zz"data/_items2";dc=1;df.dc=df;tmL=0;tmR=0;ar='';al='';ch='';dt=''
  11. ir='1-';co='';c=0;col='';lo=1;hi=10;width=63
  12.  
  13. START:;tr "f1cePGN cdTitle c6Editcb> ca"df"n1"
  14.   if open(f1,df,'r') then do ; do i=1 until eof(f1)
  15.     d=readch(f1,228) ; if d='' then leave
  16.     parse var d j 3 p"00"x 56 a"00"x 119 j 199 d 200 j
  17.     n.i=a ; d.i=c2d(d) ; p.i=p
  18.     tr "cf"right(i,2)" cb<"word("ce--- c9DIR",d.i+1)"cb> ce"n.i
  19.     end i ; tot=i-1 ; if tot<10 then hi=tot ; call close(f1) ; tr ; end
  20.   else do ; tot=0 ; tr " c6This cfDirectory c6is c9Emptyc6!n1" ; end
  21.   if dc>1 then tr " caBcb> cfBack to cePARENT cfDirectory"
  22.   tr " cdQcb> cfQuit cePGN cdTitle c6Editn1"
  23.   se "c6Type cf# c6of cb<c9DIRcb> c6to enter, or press caENTER c6to edit this listcb> cai1 2}"
  24.   gu 70;a=result;if a=''&tot>0 then signal EDIT;if a~="Q"&tot=0 then a="B"
  25.   if (a="B"|a="P"|a="-"|a="<")&dc>1 then do;dc=dc-1;df=df.dc;signal START;end
  26.   if a<1|a>tot|d.a=0 then signal QUIT
  27.   dc=dc+1;df.dc=zz||p.a'/data/_items2';df=df.dc;signal START
  28.  
  29. EDIT:;tr "f1cePGN cdTitle c6Editcb> ca"df" cf(cb"tot" c6itemscf)n1"
  30.   do i=lo to hi;se "cf"right(i,2)"cb> ce";send n.i;tr;end i;tr
  31.   se " cf,cb> ceAppend to cbleft  ceside cf[cb";send al;tr "cf]"
  32.   se " cf.cb> c6Append to caright c6side cf[ca";send ar;tr "cf]"
  33.   se " cfDcb> ceDelete   string text cf[c9";send dt;tr "cf]"
  34.   se " cfTcb> c6Truncate string text cf[cd";send ch;tr "cf]"
  35.   tr " cfLcb> ceTrim from cbleft  ceside "left("cf[cb"tmL"cf]",21)"cfRcb> ceTrim from caright ceside cf[ca"tmR"cf]"
  36.   tr " cfCcb> c6Cycle colors through "left("cf[ca"co"cf]",21)"cfEcb> c6Edit range  of items cf[ca"ir"cf]"
  37.   if hi<tot then se " cfNcb> ceNext cb10 ceitems ";if lo>1 then se " cfPcb> cePast cb10 ceitems "
  38.   tr " ccBcb> ccBack a menu  c9Scb> c9Save  cdQcb> cdQuit";se "n1c6Enter edit optioncb> cf"
  39. EDIT2:;gc;a=result;if a="Q" then do;tr "cdQuit";signal QUIT;end
  40.   if (a="B"|a="-"|a="<"|(a="P"&lo=1)) then do;tr "Back a menu";signal START;end
  41.   if a="S" then do;tr "cbSave";signal SAVE;end
  42.   if a="N"&hi<tot then do;tr "Next 10";lo=lo+10;hi=lo+9;if hi>tot then hi=tot;signal EDIT;end
  43.   if a="P"&lo>1 then do;tr "Past 10";lo=lo-10;hi=lo+9;signal EDIT;end
  44.   if a="L" then do;tr "Left trim";se "c6Trim how many characters from cbleft c6side of title? cbi0 2}"
  45.     gu 70;tmL=result;if tmL='' then tmL=0;signal EDIT;end
  46.   if a="R" then do;tr "Right trim";se "c6Trim how many characters from caright c6side of title? cai0 2}"
  47.     gu 70;tmR=result;if tmR='' then tmR=0;signal EDIT;end
  48.   if a="," then do;tr "Left append";se "c6Text to add to cbleft c6side of title? cbi256 38}"
  49.     gu 70;al=result;if index(upper(al),"C0")>0|index(upper(al),"C0}")>0 then do
  50.     se "c9Cautioncb> c6It's c9NOT c6a good idea to use cfBLACK c6as a color in item titles. c7<ccKeyc7>g1";end;signal EDIT;end
  51.   if a="." then do;tr "Right append";se "c6Text to add to caright c6side of string? cai256 38}"
  52.     gu 70;ar=result;if index(upper(ar),"C0")>0|index(upper(ar),"C0}")>0 then do
  53.     se "c9Cautioncb> c6It's c9NOT c6a good idea to use cfBLACK c6as a color in item titles. c7<ccKeyc7>g1";end;signal EDIT;end
  54.   if a="D" then do;tr "Delete text";se "c6Text to c9delete c6from specified items? c9i256 38}"
  55.     gu 70;dt=result;signal EDIT;end
  56.   if a="T" then do;tr "Truncate text";se "c6Truncate item cdstarting c6at what text? cdi256 38}"
  57.     gu 70;ch=result;signal EDIT;end
  58.   if a="C" then do;tr "Cycle colors";se "c6Enter mci colors to c9cycle c6through listing? c9i1 10}"
  59.     gu 70;co=result;c=1;cc=length(co);if cc>0 then do i=1 to cc;if index("123456789ABCDEF",substr(co,i,1))=0 then do
  60.     se "c9Invalid c6MCI color code entered! c7<ccKeyc7>g1";co='';c=0;signal EDIT;end;end i
  61.     if co='' then do;c=0;col='';end;signal EDIT;end
  62.   if a="E"|a="I" then do;tr "Edit range";se "c6Enter item numbers to effect by editing? i0 15}"
  63.     gu 70;ir=result;if ir='' then ir="1-";signal EDIT;end
  64.  signal EDIT2
  65.  
  66. SAVE:;rtot=PARSE(ir,1,tot);trim=0;do i=1 to rtot;ii=it.i
  67.   do until index(n.ii,dt)=0;a=index(n.ii,dt)
  68.     if a>0 then n.ii=delstr(n.ii,a,length(dt));end
  69.   if c>0 then do;col='c'substr(co,c,1);c=c+1;if c>cc then c=1;end
  70.   if ch~=''&index(n.ii,ch)>0 then n.ii=strip(left(n.ii,index(n.ii,ch)-1))
  71.   n.ii=al||col||substr(n.ii,tmL+1,length(n.ii)-(tmR+tmL))||ar
  72.   if length(n.ii)>width then do;n.ii=left(n.ii,width);trim=1;end
  73.   end i;tr "f1c6Here's how the cfNEW c6listing will lookcb>n1"
  74.   do i=1 to tot;tr "cf"right(i,2)"cb> ce"n.i;end i
  75.   if trim=1 then tr "n1c9Cautioncb> c6One or more items exceeded the ca"width" character c9max c6length."
  76.   se "n1ceOK c6to cbSavec6? c7[cbYesc7]c6: cb";gc;a=result
  77.   if a="N" then do;tr "c9Noc6.";signal EDIT;end;se "Yesc6! caSavingc7..."
  78.   call open(f1,df,'a');call seek(f1,56,'b');do i=1 to tot
  79.   call writech(f1,left(n.i,64,"00"x));call seek(f1,164);end i;call close(f1)
  80.   se "h6caedc6!n2cdEdit c6more lists? c7[cbYesc7]c6: cb";gc;a=result
  81.   if a="N" then do;tr "c9Noc6.";signal QUIT;end;else tr "Yesc6!";c=1;signal START
  82.  
  83. QUIT:;tr "n1cePGN cdTitle c6Editc7, cfv1.1 c7(ca13-Jun-95c7) by cdDotoranc7!";exit
  84.  
  85. PARSE: procedure expose it.;arg rng,min,max;it.='';c=0;it=translate(rng,'  ','.,');do a=1 to words(it);c=c+1;it.c=word(it,a);if index(it.c,'-')>0 then do;parse var it.c x'-'y
  86.   if y='' then y=max;if x='' then x=min;if x>y then do;d=x;x=y;y=d;end;if x<min|y>max|~datatype(x,'W')|~datatype(y,'W') then do;c=c-1;iterate;end
  87.   do b=x to y;it.c=b;c=c+1;end;c=c-1;end;else if it.c<min|it.c>max|~datatype(it.c,'W') then do;c=c-1;iterate;end;end;return c
  88.  
  89. SYNTAX:;ERROR:;IOERR:;e1=' Error: 'rc' ('errortext(rc)')'
  90.   e2='  Line: 'left(sigl,4)'File:';gu 1311992;a=result;gu 1311960;b=result;c='"'a||b'"';e2=e2' 'c;tr e1;tr e2;logentry e1;logentry e2
  91.   e=sourceline(sigl);do while e~='';e3='Source: 'left(e,37);tr e3;logentry e3;e=substr(e,38);end;bufferflush;exit
  92. /** Last Edited: 13-Jun-95 ************************************************\
  93. \****************************************** Frontiers BBS (716)/823-9892 **/
  94.